package com.heima.kafka.controller;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class HelloController {

    @Autowired
    KafkaTemplate<String,String> kafkaTemplate;

    @RequestMapping("hello")
    public String hello(String msg){
        kafkaTemplate.send("itcast-topic","spring-kafka",msg);
        return "ok";
    }
}
